package com.bt7274.enums;

import lombok.Getter;

/**
 * @Author galland
 * @Description Result Code Enumeration
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "操作成功"),

    // 普通错误
    ERROR(500, "操作失败"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),

    // 用户相关错误
    USERNAME_ALREADY_EXISTS(4007, "用户名已存在"),
    EMAIL_ALREADY_EXISTS(4008, "邮箱已被注册"),
    USER_NOT_EXISTS(4009, "用户不存在"),
    PASSWORD_ERROR(4010, "密码错误"),
    USER_ACCOUNT_DISABLED(4011, "账号已被禁用"),
    INVALID_TOKEN(1006, "Invalid token"),
    TOKEN_EXPIRED(1007, "Token has expired"),
    INVALID_INVITE_CODE(1008, "Invalid invite code"),
    INSUFFICIENT_INVITE_COUNT(1009, "Insufficient invite count"),
    SYSTEM_ERROR(500, "系统错误"),
    PARAM_ERROR(400, "参数错误"),
    USERNAME_EMPTY(4001, "用户名不能为空"),
    USERNAME_LENGTH_ERROR(4002, "用户名长度必须在3-16个字符之间"),
    PASSWORD_EMPTY(4003, "密码不能为空"),
    PASSWORD_LENGTH_ERROR(4004, "密码长度必须在6-20个字符之间"),
    EMAIL_EMPTY(4005, "邮箱不能为空"),
    EMAIL_FORMAT_ERROR(4006, "邮箱格式不正确"),
    REGISTER_FAILED(4012, "注册失败，请稍后重试");
    ;

    private final Integer code;
    private final String message;

    ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}